from rest_framework import serializers
from rest_framework.serializers import ModelSerializer

from goods.models import SPUSpecification, SPU


class SPUSpecificationSerializer(ModelSerializer):
    spu = serializers.StringRelatedField(read_only=True)
    spu_id = serializers.IntegerField()


    class Meta:
        model = SPUSpecification
        fields = '__all__'

class SPUserializer(ModelSerializer):

    class Meta:
        model = SPU
        fields = ('id','name')